package com.chixing.controller;

import com.chixing.entity.Car;
import com.chixing.service.ICarService;
import com.chixing.service.RecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
public class RecommendController {

    @Autowired
    private RecommendService recommendService;
    @Autowired
    private ICarService carServiceImpl;

    @GetMapping("recommendByUser")
    public ModelAndView getRecommendProductByUser(@RequestParam("custId") Integer custId, @RequestParam("num")  int num){
        List<Car> hotCar = recommendService.getRecommentProductByUser(custId,num);
        ModelAndView mav = new ModelAndView();
        mav.addObject("hotCarData",hotCar);
        mav.setViewName("customer/personalCenter-LeaseCar");
        System.out.println(mav);
        return mav;

    }
    @GetMapping("recommendByProduct")
    public List<Car> getRecommendProductByProduct(@RequestParam("custId")Integer custId,@RequestParam("carId")Integer carId ,@RequestParam("num")int num){
        return recommendService.getRecommentProductByProduct(custId,carId,num);
    }


}
